package com.backend.modules.statistics.controller;

import com.backend.common.model.R;
import com.backend.modules.statistics.service.StatisticsService;
import com.backend.modules.statistics.vo.*;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Tag(name = "统计分析", description = "统计分析相关接口")
@RestController
@RequestMapping("/v1/statistics")
@RequiredArgsConstructor
public class StatisticsController {

    private final StatisticsService statisticsService;

    @Operation(summary = "获取管理员统计数据")
    @GetMapping("/admin")
    public R<AdminStatisticsVO> getAdminStatistics(
            @RequestParam(required = false) Long gradeId,
            @RequestParam(required = false) Long majorId,
            @RequestParam(required = false) Long classId) {
        return R.ok(statisticsService.getAdminStatistics(gradeId, majorId, classId));
    }

    @Operation(summary = "获取教师统计数据")
    @GetMapping("/teacher")
    public R<TeacherStatisticsVO> getTeacherStatistics(
            @RequestParam(required = false) Long classId) {
        return R.ok(statisticsService.getTeacherStatistics(classId));
    }

    @Operation(summary = "获取学生统计数据")
    @GetMapping("/student")
    public R<StudentStatisticsVO> getStudentStatistics() {
        return R.ok(statisticsService.getStudentStatistics());
    }
} 